package pers.jason.wppm.auth.api.validate;


import pers.jason.wppm.auth.api.enums.EnumVerifiable;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;

/**
 * 自定义校验注解，校验字符串参数是否属于指定枚举值
 */
@Documented
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = EnumInValidator.class)
public @interface EnumIn {

    String message() default "不正确的枚举类型";

    Class<?>[] groups() default { };

    Class<? extends Payload>[] payload() default { };

    Class<? extends EnumVerifiable> enumType();

}
